<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Roles - The meteor-roles API</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="The meteor-roles API" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: v1.2.14</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/Roles.html">Roles</a></li>
                                <li><a href="../classes/UIHelpers.html">UIHelpers</a></li>
                            </ul>
                
                
                            <ul id="api-modules" class="apis modules">
                                <li><a href="../modules/Roles.html">Roles</a></li>
                                <li><a href="../modules/UIHelpers.html">UIHelpers</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1>Roles Class</h1>
<div class="box meta">


        <div class="foundat">
            Defined in: <a href="../files/roles_roles_common.js.html#l29"><code>roles&#x2F;roles_common.js:29</code></a>
        </div>

            Module: <a href="../modules/Roles.html">Roles</a>

</div>


<div class="box intro">
    
</div>


<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
            <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                            <li class="index-item method private">
                                <a href="#method__addRoleToParent">_addRoleToParent</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__addUserToRole">_addUserToRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__assureConsistency">_assureConsistency</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__backwardMigrate">_backwardMigrate</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__checkRoleName">_checkRoleName</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__checkRoleName">_checkRoleName</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__convertToNewField">_convertToNewField</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__convertToNewRole">_convertToNewRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__convertToOldField">_convertToOldField</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__convertToOldRole">_convertToOldRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__defaultUpdateRole">_defaultUpdateRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__defaultUpdateUser">_defaultUpdateUser</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__dropCollectionIndex">_dropCollectionIndex</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__forwardMigrate">_forwardMigrate</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__isNewField">_isNewField</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__isNewRole">_isNewRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__isOldField">_isOldField</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__isOldRole">_isOldRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__normalizeOptions">_normalizeOptions</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__normalizeScopeName">_normalizeScopeName</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__onlyAssignedMatcher">_onlyAssignedMatcher</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__removeRoleFromParent">_removeRoleFromParent</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__removeUserFromRole">_removeUserFromRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__resolveUser">_resolveUser</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__roleAndScopeMatcher">_roleAndScopeMatcher</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__roleMatcher">_roleMatcher</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__scopeMatcher">_scopeMatcher</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method private">
                                <a href="#method__usersInRoleQuery">_usersInRoleQuery</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_addRolesToParent">addRolesToParent</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_addUsersToRoles">addUsersToRoles</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_createRole">createRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_deleteRole">deleteRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getAllRoles">getAllRoles</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method deprecated">
                                <a href="#method_getGroupsForUser">getGroupsForUser</a>

                                    <span class="flag static">static</span>
                                    <span class="flag deprecated">deprecated</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getRolesForUser">getRolesForUser</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getScopesForUser">getScopesForUser</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getUsersInRole">getUsersInRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_removeRolesFromParent">removeRolesFromParent</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_removeScope">removeScope</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_removeUsersFromRoles">removeUsersFromRoles</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_renameRole">renameRole</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_renameScope">renameScope</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_setUserRoles">setUserRoles</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_userIsInRole">userIsInRole</a>

                                    <span class="flag static">static</span>
                            </li>
                    </ul>
                </div>

                <div class="index-section properties">
                    <h3>Properties</h3>

                    <ul class="index-list properties">
                            <li class="index-item property deprecated">
                                <a href="#property_GLOBAL_GROUP">GLOBAL_GROUP</a>

                                    <span class="flag static">static</span>
                                    <span class="flag deprecated">deprecated</span>
                            </li>
                            <li class="index-item property">
                                <a href="#property_subscription">subscription</a>

                                    <span class="flag static">static</span>
                            </li>
                    </ul>
                </div>


        </div>

            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

<div id="method__addRoleToParent" class="method item private">
    <h3 class="name"><code>_addRoleToParent</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
                <li class="arg">
                        <code>parentName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l212"><code>roles&#x2F;roles_common.js:212</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of role.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">parentName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of parent role.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__addUserToRole" class="method item private">
    <h3 class="name"><code>_addUserToRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code>roleName</code>
                </li>
                <li class="arg">
                        <code>options</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l488"><code>roles&#x2F;roles_common.js:488</code></a>
        </p>



    </div>

    <div class="description">
        <p>Add one user to one role.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or object with an <code>_id</code> field.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of the role to add the user to. The role have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">options</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope, or <code>null</code> for the global role</li>
<li><code>ifExists</code>: if <code>true</code>, do not throw an exception if the role does not exist</li>
<li><code>_assigned</code>: internal option, should not be used publicly because it will break assumptions
in te code; publicly, you can only add users to an assigned role
should the role be set as assigned (<code>true</code>), <code>null</code> is the same as <code>false</code>,
only that it does not force the value to <code>false</code> if the role is already assigned</li>
</ul>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>Roles set during the call (even those already set).</p>

            </div>
        </div>


</div>
<div id="method__assureConsistency" class="method item private">
    <h3 class="name"><code>_assureConsistency</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l723"><code>roles&#x2F;roles_common.js:723</code></a>
        </p>



    </div>

    <div class="description">
        <p>Makes sure all subroles are correctly set, and no extra subroles are set which should not be.</p>
<p>Used internally after complicated changes, but it can also be used whenever one feels that
there might be inconsistencies (eg., after a crash).</p>
<p>We simply re-set to the user their assigned roles again and remove any roles which
are marked as not explicitly assigned, and have not been part of what we currently set.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or an actual user object.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__backwardMigrate" class="method item private">
    <h3 class="name"><code>_backwardMigrate</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>updateUser</code>
                </li>
                <li class="arg">
                        <code>updateRole</code>
                </li>
                <li class="arg">
                        <code>usingGroups</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l285"><code>roles&#x2F;roles_server.js:285</code></a>
        </p>



    </div>

    <div class="description">
        <p>Migrates <code>Meteor.users</code> and <code>Meteor.roles</code> to the old format.</p>
<p>We assume that we are converting back a failed migration, so values can only be
what were valid values in the old format. So no group names starting with <code>$</code> and
no subroles.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">updateUser</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>Function which updates the user object. Default <code>_defaultUpdateUser</code>.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">updateRole</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>Function which updates the role object. Default <code>_defaultUpdateRole</code>.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">usingGroups</code>
                        <span class="type">Boolean</span>


                    <div class="param-description">
                        <p>Should we use groups or not.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__checkRoleName" class="method item private">
    <h3 class="name"><code>_checkRoleName</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1219"><code>roles&#x2F;roles_common.js:1219</code></a>
        </p>



    </div>

    <div class="description">
        <p>Throw an exception if <code>roleName</code> is an invalid role name.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A role name to match against.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__checkRoleName" class="method item private">
    <h3 class="name"><code>_checkRoleName</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>scopeName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1273"><code>roles&#x2F;roles_common.js:1273</code></a>
        </p>



    </div>

    <div class="description">
        <p>Throw an exception if <code>scopeName</code> is an invalid scope name.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">scopeName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A scope name to match against.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__convertToNewField" class="method item private">
    <h3 class="name"><code>_convertToNewField</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>oldRoles</code>
                </li>
                <li class="arg">
                        <code>convertUnderscoresToDots</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l112"><code>roles&#x2F;roles_server.js:112</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">oldRoles</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p><code>Meteor.users</code> document <code>roles</code> field in the old format.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">convertUnderscoresToDots</code>
                        <span class="type">Boolean</span>


                    <div class="param-description">
                        <p>Should we convert underscores to dots in group names.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>Converted <code>roles</code> to the new format.</p>

            </div>
        </div>


</div>
<div id="method__convertToNewRole" class="method item private">
    <h3 class="name"><code>_convertToNewRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>oldRole</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Object</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l79"><code>roles&#x2F;roles_server.js:79</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">oldRole</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p><code>Meteor.roles</code> document.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Object</span>:
                    <p>Converted <code>role</code> to the new format.</p>

            </div>
        </div>


</div>
<div id="method__convertToOldField" class="method item private">
    <h3 class="name"><code>_convertToOldField</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>newRoles</code>
                </li>
                <li class="arg">
                        <code>usingGroups</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l158"><code>roles&#x2F;roles_server.js:158</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">newRoles</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p><code>Meteor.users</code> document <code>roles</code> field in the new format.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">usingGroups</code>
                        <span class="type">Boolean</span>


                    <div class="param-description">
                        <p>Should we use groups or not.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>Converted <code>roles</code> to the old format.</p>

            </div>
        </div>


</div>
<div id="method__convertToOldRole" class="method item private">
    <h3 class="name"><code>_convertToOldRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>newRole</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Object</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l96"><code>roles&#x2F;roles_server.js:96</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">newRole</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p><code>Meteor.roles</code> document.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Object</span>:
                    <p>Converted <code>role</code> to the old format.</p>

            </div>
        </div>


</div>
<div id="method__defaultUpdateRole" class="method item private">
    <h3 class="name"><code>_defaultUpdateRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>oldRole</code>
                </li>
                <li class="arg">
                        <code>newRole</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l225"><code>roles&#x2F;roles_server.js:225</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">oldRole</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>Old <code>Meteor.roles</code> document.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">newRole</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>New <code>Meteor.roles</code> document.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__defaultUpdateUser" class="method item private">
    <h3 class="name"><code>_defaultUpdateUser</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code>roles</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l207"><code>roles&#x2F;roles_server.js:207</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p><code>Meteor.users</code> document.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | Object</span>


                    <div class="param-description">
                        <p>Value to which user's <code>roles</code> field should be set.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__dropCollectionIndex" class="method item private">
    <h3 class="name"><code>_dropCollectionIndex</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>collection</code>
                </li>
                <li class="arg">
                        <code>indexName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l238"><code>roles&#x2F;roles_server.js:238</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">collection</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>Collection on which to drop the index.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">indexName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of the index to drop.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__forwardMigrate" class="method item private">
    <h3 class="name"><code>_forwardMigrate</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>updateUser</code>
                </li>
                <li class="arg">
                        <code>updateRole</code>
                </li>
                <li class="arg">
                        <code>convertUnderscoresToDots</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l255"><code>roles&#x2F;roles_server.js:255</code></a>
        </p>



    </div>

    <div class="description">
        <p>Migrates <code>Meteor.users</code> and <code>Meteor.roles</code> to the new format.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">updateUser</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>Function which updates the user object. Default <code>_defaultUpdateUser</code>.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">updateRole</code>
                        <span class="type">Function</span>


                    <div class="param-description">
                        <p>Function which updates the role object. Default <code>_defaultUpdateRole</code>.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">convertUnderscoresToDots</code>
                        <span class="type">Boolean</span>


                    <div class="param-description">
                        <p>Should we convert underscores to dots in group names.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__isNewField" class="method item private">
    <h3 class="name"><code>_isNewField</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roles</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l53"><code>roles&#x2F;roles_server.js:53</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p><code>Meteor.users</code> document <code>roles</code> field.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
                    <p>Returns <code>true</code> if the <code>roles</code> field is in the new format.
If it is ambiguous or it is not, returns <code>false</code>.</p>

            </div>
        </div>


</div>
<div id="method__isNewRole" class="method item private">
    <h3 class="name"><code>_isNewRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>role</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l27"><code>roles&#x2F;roles_server.js:27</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">role</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p><code>Meteor.roles</code> document.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
                    <p>Returns <code>true</code> if the <code>role</code> is in the new format.
If it is ambiguous or it is not, returns <code>false</code>.</p>

            </div>
        </div>


</div>
<div id="method__isOldField" class="method item private">
    <h3 class="name"><code>_isOldField</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roles</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l66"><code>roles&#x2F;roles_server.js:66</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p><code>Meteor.users</code> document <code>roles</code> field.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
                    <p>Returns <code>true</code> if the <code>roles</code> field is in the old format.
If it is ambiguous or it is not, returns <code>false</code>.</p>

            </div>
        </div>


</div>
<div id="method__isOldRole" class="method item private">
    <h3 class="name"><code>_isOldRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>role</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_server.js.html#l40"><code>roles&#x2F;roles_server.js:40</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">role</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p><code>Meteor.roles</code> document.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
                    <p>Returns <code>true</code> if the <code>role</code> is in the old format.
If it is ambiguous or it is not, returns <code>false</code>.</p>

            </div>
        </div>


</div>
<div id="method__normalizeOptions" class="method item private">
    <h3 class="name"><code>_normalizeOptions</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>options</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Object</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1233"><code>roles&#x2F;roles_common.js:1233</code></a>
        </p>



    </div>

    <div class="description">
        <p>Normalize options.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">options</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>Options to normalize.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Object</span>:
                    <p>Normalized options.</p>

            </div>
        </div>


</div>
<div id="method__normalizeScopeName" class="method item private">
    <h3 class="name"><code>_normalizeScopeName</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>scopeName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">String</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1254"><code>roles&#x2F;roles_common.js:1254</code></a>
        </p>



    </div>

    <div class="description">
        <p>Normalize scope name.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">scopeName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A scope name to normalize.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">String</span>:
                    <p>Normalized scope name.</p>

            </div>
        </div>


</div>
<div id="method__onlyAssignedMatcher" class="method item private">
    <h3 class="name"><code>_onlyAssignedMatcher</code></h3>

        <span class="paren">()</span>

        <span class="returns-inline">
            <span class="type">Function</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1206"><code>roles&#x2F;roles_common.js:1206</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>


        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Function</span>:
                    <p>A matcher function which accepts a role object and returns <code>true</code>
if the role is an assigned role.</p>

            </div>
        </div>


</div>
<div id="method__removeRoleFromParent" class="method item private">
    <h3 class="name"><code>_removeRoleFromParent</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
                <li class="arg">
                        <code>parentName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l316"><code>roles&#x2F;roles_common.js:316</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of role.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">parentName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of parent role.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__removeUserFromRole" class="method item private">
    <h3 class="name"><code>_removeUserFromRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code>roleName</code>
                </li>
                <li class="arg">
                        <code>options</code>
                </li>
            </ul><span class="paren">)</span>
        </div>



        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l655"><code>roles&#x2F;roles_common.js:655</code></a>
        </p>



    </div>

    <div class="description">
        <p>Remove one user from one role.</p>
<p>WARNING: It leaves user's roles in a possibly inconsistent state. Because we allow the same
role to be a child of multiple roles it might happen that it removes some subroles which
it should not because they are in effect also through some other parent role. You should always
call <code>_assureConsistency</code> after you are finished with calls to <code>_removeUserFromRole</code> for a
particular user.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or object with an <code>_id</code> field.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of the role to add the user to. The role have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">options</code>
                        <span class="type">Object</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope, or <code>null</code> for the global role</li>
<li><code>_assigned</code>: internal option, should not be used publicly because it will break assumptions
in te code; publicly, you can only remove users from an assigned role
if <code>true</code>, only manually assigned roles are removed, if <code>false</code>, only automatically
assigned roles are removed, if <code>null</code>, any role is removed</li>
</ul>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method__resolveUser" class="method item private">
    <h3 class="name"><code>_resolveUser</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code>force</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Object</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1133"><code>roles&#x2F;roles_common.js:1133</code></a>
        </p>



    </div>

    <div class="description">
        <p>Resolves the user ID into an actual user object with <code>roles</code> field,
if it is not already.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or an actual user object.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">force</code>
                        <span class="type">Boolean</span>


                    <div class="param-description">
                        <p>Load a new user object even if it is already one.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Object</span>:
                    <p>User object.</p>

            </div>
        </div>


</div>
<div id="method__roleAndScopeMatcher" class="method item private">
    <h3 class="name"><code>_roleAndScopeMatcher</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
                <li class="arg">
                        <code>scope</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Function</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1173"><code>roles&#x2F;roles_common.js:1173</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A role name to match against.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">scope</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A scope to match against.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Function</span>:
                    <p>A matcher function which accepts a role object and returns <code>true</code>
if its name matches <code>roleName</code>, and scope matches <code>scope</code>.</p>

            </div>
        </div>


</div>
<div id="method__roleMatcher" class="method item private">
    <h3 class="name"><code>_roleMatcher</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Function</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1159"><code>roles&#x2F;roles_common.js:1159</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A role name to match against.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Function</span>:
                    <p>A matcher function which accepts a role object and returns <code>true</code>
if its name matches <code>roleName</code>.</p>

            </div>
        </div>


</div>
<div id="method__scopeMatcher" class="method item private">
    <h3 class="name"><code>_scopeMatcher</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>scope</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Function</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1190"><code>roles&#x2F;roles_common.js:1190</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">scope</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>A scope to match against.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Function</span>:
                    <p>A matcher function which accepts a role object and returns <code>true</code>
if its scope matches <code>scope</code>.</p>

            </div>
        </div>


</div>
<div id="method__usersInRoleQuery" class="method item private">
    <h3 class="name"><code>_usersInRoleQuery</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roles</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
                <li class="arg">
                        <code class="optional">[queryOptions]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Object</span>
        </span>


        <span class="flag private">private</span>


        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l965"><code>roles&#x2F;roles_common.js:965</code></a>
        </p>



    </div>

    <div class="description">
        
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name of role or an array of roles. If array, users
returned will have at least one of the roles
specified but need not have <em>all</em> roles.
Roles do not have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope to restrict roles to; user's global
roles will also be checked</li>
<li><code>anyScope</code>: if set, role can be in any scope (<code>scope</code> option is ignored)</li>
<li><code>queryOptions</code>: options which are passed directly
through to <code>Meteor.users.find(query, options)</code></li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[queryOptions]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options which are passed directly
through to <code>Meteor.users.find(query, options)</code></p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Object</span>:
                    <p>Object with <code>query</code> and <code>queryOptions</code>.</p>

            </div>
        </div>


</div>
<div id="method_addRolesToParent" class="method item">
    <h3 class="name"><code>addRolesToParent</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>rolesNames</code>
                </li>
                <li class="arg">
                        <code>parentName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l192"><code>roles&#x2F;roles_common.js:192</code></a>
        </p>



    </div>

    <div class="description">
        <p>Add role parent to roles.</p>
<p>Previous parents are kept (role can have multiple parents). For users which have the
parent role set, new subroles are added automatically.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">rolesNames</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name(s) of role(s).</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">parentName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of parent role.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_addUsersToRoles" class="method item">
    <h3 class="name"><code>addUsersToRoles</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>users</code>
                </li>
                <li class="arg">
                        <code>roles</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l378"><code>roles&#x2F;roles_common.js:378</code></a>
        </p>



    </div>

    <div class="description">
        <p>Add users to roles.</p>
<p>Adds roles to existing roles for each user.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">users</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>User ID(s) or object(s) with an <code>_id</code> field.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name(s) of roles to add users to. Roles have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope, or <code>null</code> for the global role</li>
<li><code>ifExists</code>: if <code>true</code>, do not throw an exception if the role does not exist</li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
            </ul>
        </div>



        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>Roles.addUsersToRoles(userId, 'admin')
Roles.addUsersToRoles(userId, ['view-secrets'], 'example.com')
Roles.addUsersToRoles([user1, user2], ['user','editor'])
Roles.addUsersToRoles([user1, user2], ['glorious-admin', 'perform-action'], 'example.org')</code></pre>

            </div>
        </div>
</div>
<div id="method_createRole" class="method item">
    <h3 class="name"><code>createRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">String</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l51"><code>roles&#x2F;roles_common.js:51</code></a>
        </p>



    </div>

    <div class="description">
        <p>Create a new role.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of role.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>unlessExists</code>: if <code>true</code>, exception will not be thrown in the role already exists</li>
</ul>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">String</span>:
                    <p>ID of the new role.</p>

            </div>
        </div>


</div>
<div id="method_deleteRole" class="method item">
    <h3 class="name"><code>deleteRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roleName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l82"><code>roles&#x2F;roles_common.js:82</code></a>
        </p>



    </div>

    <div class="description">
        <p>Delete an existing role.</p>
<p>If the role is set for any user, it is automatically unset.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roleName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of role.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_getAllRoles" class="method item">
    <h3 class="name"><code>getAllRoles</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code class="optional">[queryOptions]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Cursor</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l919"><code>roles&#x2F;roles_common.js:919</code></a>
        </p>



    </div>

    <div class="description">
        <p>Retrieve cursor of all existing roles.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name optional">[queryOptions]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options which are passed directly
through to <code>Meteor.roles.find(query, options)</code>.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Cursor</span>:
                    <p>Cursor of existing roles.</p>

            </div>
        </div>


</div>
<div id="method_getGroupsForUser" class="method item deprecated">
    <h3 class="name"><code>getGroupsForUser</code></h3>

        <span class="paren">()</span>


        <span class="flag deprecated">deprecated</span>



        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1031"><code>roles&#x2F;roles_common.js:1031</code></a>
        </p>



    </div>

    <div class="description">
        <p>Deprecated. Use <code>getScopesForUser</code> instead.</p>

    </div>




</div>
<div id="method_getRolesForUser" class="method item">
    <h3 class="name"><code>getRolesForUser</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l869"><code>roles&#x2F;roles_common.js:869</code></a>
        </p>



    </div>

    <div class="description">
        <p>Retrieve user's roles.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or an actual user object.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of scope to provide roles for; if not specified, global roles are returned</li>
<li><code>anyScope</code>: if set, role can be in any scope (<code>scope</code> option is ignored)</li>
<li><code>fullObjects</code>: return full roles objects (<code>true</code>) or just names (<code>false</code>) (default <code>false</code>)</li>
<li><code>onlyAssigned</code>: return only assigned roles and not automatically inferred (like subroles)</li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>Array of user's roles, unsorted.</p>

            </div>
        </div>


</div>
<div id="method_getScopesForUser" class="method item">
    <h3 class="name"><code>getScopesForUser</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code class="optional">[roles]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1047"><code>roles&#x2F;roles_common.js:1047</code></a>
        </p>



    </div>

    <div class="description">
        <p>Retrieve users scopes, if any.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or an actual user object.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[roles]</code>
                        <span class="type">Array | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Name of roles to restrict scopes to.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>Array of user's scopes, unsorted.</p>

            </div>
        </div>


</div>
<div id="method_getUsersInRole" class="method item">
    <h3 class="name"><code>getUsersInRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>roles</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
                <li class="arg">
                        <code class="optional">[queryOptions]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Cursor</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l934"><code>roles&#x2F;roles_common.js:934</code></a>
        </p>



    </div>

    <div class="description">
        <p>Retrieve all users who are in target role.</p>
<p>Options:</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name of role or an array of roles. If array, users
returned will have at least one of the roles
specified but need not have <em>all</em> roles.
Roles do not have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope to restrict roles to; user's global
roles will also be checked</li>
<li><code>anyScope</code>: if set, role can be in any scope (<code>scope</code> option is ignored)</li>
<li><code>queryOptions</code>: options which are passed directly
through to <code>Meteor.users.find(query, options)</code></li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[queryOptions]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options which are passed directly
through to <code>Meteor.users.find(query, options)</code></p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Cursor</span>:
                    <p>Cursor of users in roles.</p>

            </div>
        </div>


</div>
<div id="method_removeRolesFromParent" class="method item">
    <h3 class="name"><code>removeRolesFromParent</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>rolesNames</code>
                </li>
                <li class="arg">
                        <code>parentName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l296"><code>roles&#x2F;roles_common.js:296</code></a>
        </p>



    </div>

    <div class="description">
        <p>Remove role parent from roles.</p>
<p>Other parents are kept (role can have multiple parents). For users which have the
parent role set, removed subrole is removed automatically.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">rolesNames</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name(s) of role(s).</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">parentName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Name of parent role.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_removeScope" class="method item">
    <h3 class="name"><code>removeScope</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1112"><code>roles&#x2F;roles_common.js:1112</code></a>
        </p>



    </div>

    <div class="description">
        <p>Remove a scope.</p>
<p>Roles assigned with a given scope are removed.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>The name of a scope.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_removeUsersFromRoles" class="method item">
    <h3 class="name"><code>removeUsersFromRoles</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>users</code>
                </li>
                <li class="arg">
                        <code>roles</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l608"><code>roles&#x2F;roles_common.js:608</code></a>
        </p>



    </div>

    <div class="description">
        <p>Remove users from assigned roles.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">users</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>User ID(s) or object(s) with an <code>_id</code> field.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name(s) of roles to add users to. Roles have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope, or <code>null</code> for the global role</li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
            </ul>
        </div>



        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>Roles.removeUsersFromRoles(userId, 'admin')
Roles.removeUsersFromRoles([userId, user2], ['editor'])
Roles.removeUsersFromRoles(userId, ['user'], 'group1')</code></pre>

            </div>
        </div>
</div>
<div id="method_renameRole" class="method item">
    <h3 class="name"><code>renameRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>oldName</code>
                </li>
                <li class="arg">
                        <code>newName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l134"><code>roles&#x2F;roles_common.js:134</code></a>
        </p>



    </div>

    <div class="description">
        <p>Rename an existing role.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">oldName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Old name of a role.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">newName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>New name of a role.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_renameScope" class="method item">
    <h3 class="name"><code>renameScope</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>oldName</code>
                </li>
                <li class="arg">
                        <code>newName</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l1079"><code>roles&#x2F;roles_common.js:1079</code></a>
        </p>



    </div>

    <div class="description">
        <p>Rename a scope.</p>
<p>Roles assigned with a given scope are changed to be under the new scope.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">oldName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>Old name of a scope.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">newName</code>
                        <span class="type">String</span>


                    <div class="param-description">
                        <p>New name of a scope.</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_setUserRoles" class="method item">
    <h3 class="name"><code>setUserRoles</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>users</code>
                </li>
                <li class="arg">
                        <code>roles</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l427"><code>roles&#x2F;roles_common.js:427</code></a>
        </p>



    </div>

    <div class="description">
        <p>Set users' roles.</p>
<p>Replaces all existing roles with a new set of roles.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">users</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>User ID(s) or object(s) with an <code>_id</code> field.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name(s) of roles to add users to. Roles have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope, or <code>null</code> for the global role</li>
<li><code>ifExists</code>: if <code>true</code>, do not throw an exception if the role does not exist</li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
            </ul>
        </div>



        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>Roles.setUserRoles(userId, 'admin')
Roles.setUserRoles(userId, ['view-secrets'], 'example.com')
Roles.setUserRoles([user1, user2], ['user','editor'])
Roles.setUserRoles([user1, user2], ['glorious-admin', 'perform-action'], 'example.org')</code></pre>

            </div>
        </div>
</div>
<div id="method_userIsInRole" class="method item">
    <h3 class="name"><code>userIsInRole</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>user</code>
                </li>
                <li class="arg">
                        <code>roles</code>
                </li>
                <li class="arg">
                        <code class="optional">[options]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l771"><code>roles&#x2F;roles_common.js:771</code></a>
        </p>



    </div>

    <div class="description">
        <p>Check if user has specified roles.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">user</code>
                        <span class="type">String | Object</span>


                    <div class="param-description">
                        <p>User ID or an actual user object.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">roles</code>
                        <span class="type">Array | String</span>


                    <div class="param-description">
                        <p>Name of role or an array of roles to check against. If array,
will return <code>true</code> if user is in <em>any</em> role.
Roles do not have to exist.</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name optional">[options]</code>
                        <span class="type">Object | String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>


                    <div class="param-description">
                        <p>Options:</p>
<ul>
<li><code>scope</code>: name of the scope; if supplied, limits check to just that scope;
the user's global roles will always be checked whether scope is specified or not</li>
<li><code>anyScope</code>: if set, role can be in any scope (<code>scope</code> option is ignored)</li>
</ul>
<p>Alternatively, it can be a scope name string.</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
                    <p><code>true</code> if user is in <em>any</em> of the target roles</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>// global roles
Roles.userIsInRole(user, 'admin')
Roles.userIsInRole(user, ['admin','editor'])
Roles.userIsInRole(userId, 'admin')
Roles.userIsInRole(userId, ['admin','editor'])

// scope roles (global roles are still checked)
Roles.userIsInRole(user, 'admin', 'group1')
Roles.userIsInRole(userId, ['admin','editor'], 'group1')
Roles.userIsInRole(userId, ['admin','editor'], {scope: 'group1'})</code></pre>

            </div>
        </div>
</div>
            </div>

            <div id="properties" class="api-class-tabpanel">
                <h2 class="off-left">Properties</h2>

<div id="property_GLOBAL_GROUP" class="property item deprecated">
    <h3 class="name"><code>GLOBAL_GROUP</code></h3>
    <span class="type">Unknown</span>

        <span class="flag deprecated">deprecated</span>



        <span class="flag static">static</span>

    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_roles_common.js.html#l42"><code>roles&#x2F;roles_common.js:42</code></a>
        </p>


    </div>

    <div class="description">
        <p>Used as a global group (now scope) name. Not used anymore.</p>

    </div>



</div>
<div id="property_subscription" class="property item">
    <h3 class="name"><code>subscription</code></h3>
    <span class="type">Object</span>




        <span class="flag static">static</span>

    <div class="meta">
                <p>
                Defined in
        <a href="../files/roles_client_subscriptions.js.html#l3"><code>roles&#x2F;client&#x2F;subscriptions.js:3</code></a>
        </p>


    </div>

    <div class="description">
        <p>Subscription handle for the collection of all existing roles.</p>

    </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>Roles.subscription.ready(); // true if roles have been loaded</code></pre>

            </div>
        </div>

</div>
            </div>


    </div>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
